package com.alipear.uibase;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.FragmentActivity;

/**
 * Created by zoulinlin on 16/4/4.
 */
public class BaseFramgmentActivity extends FragmentActivity implements
        ExternActivityInterface {

    private ExternActivity mExten;
    public Context getContext() {
        return getBaseContext();
    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mExten = new ExternActivity(this);
        mExten.onCreate(savedInstanceState);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        mExten.onDestroy();
        mExten = null;
    }

    @Override
    public void onResume() {
        super.onResume();
        mExten.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
        mExten.onPause();
    }

    @Override
    public boolean isResume() {
        return mExten.isResume();
    }

    @Override
    public void showProgressDialog(String message) {
        if(mExten == null){
            return;
        }else{
            mExten.showProgressDialog(message);
        }
    }

    @Override
    public void showProgressDialog() {
        if(mExten == null){
            return;
        }else{
            mExten.showProgressDialog();
        }
    }

    @Override
    public void closeProgressDailog() {
        if(mExten == null){
            return;
        }else{
            mExten.closeProgressDailog();
        }
    }

    @Override
    public Handler getBaseHandler() {
        return mExten.getBaseHandler();
    }

    @Override
    public Activity getCurActivity() {
        return this;
    }
}
